#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
	char c[1000], temp[1000];
	gets(c);
	int len = strlen(c);
	int k, count = 0, m = 0;
	scanf("%d", &k);
	for (int i = 0; i < len; i++)//将小写转换为大写
	{
		if (c[i] >= 'a' && c[i] <= 'z')
			c[i] = (c[i] - 32);
	}
	for (int i = 0; i < len; i++)//只要c[i]不是'-'，就将它存储到temp数组中，并且temp数组的下一个位置会被指定为存储位置。
	{
		if (c[i] != '-')
			temp[m++] = c[i];
	}
	count = m;

	if (count > k)
	{
		if (count % k == 0)
		{
			int base1 = 0;
			for (int i = 0; i < count; i++)
			{
				printf("%c", temp[i]);
				base1++;
				if (base1 % k == 0 && base1 != 0 && (base1 != count))
				{
					printf("-");
				}
			}
		}
		else
		{
			int t = 0, base2 = 0;
			t = count % k;
			for (int i = 0; i < t; i++)//先打印第一组
			{
				printf("%c", temp[i]);
			}
			printf("-");
			for (int i = t; i < count; i++)
			{
				printf("%c", temp[i]);
				base2++;
				if (base2 % k == 0 && base2 != 0 && base2 != (count - t))
				{
					printf("-");
				}
			}
		}
	}
	if (count <= k)
	{
		for (int i = 0; i < count; i++)
		{
			printf("%c", temp[i]);
		}
	}
	return 0;
}